package com.lg.algorithm.ms;

import java.util.concurrent.ConcurrentHashMap;

public class BossM {

    private static ConcurrentHashMap<String, Integer> store = new ConcurrentHashMap<>();;


    public static void main(String[] args) {
        BossM.getIPCount("a");
    }



    public static int getIPCount(String key){
        return  addCount(key);
    }

    public static synchronized int  addCount(String key) {
        Integer res = store.get(key);
        if (res == null) {
            res = 1;
            store.put(key, res);
        } else {
            store.put(key, ++res);
        }
        return res;
    }
}
